package com.example.aop;

/**
 * @author yanzhao
 * @date 2022/6/6 16:26
 * @since 1.0.0
 */
public class ThrowsAdviceAdapter implements AdvisorAdapter {

    @Override
    public boolean supportsAdvice(Advice advice) {
        return advice instanceof ThrowsAdvice;
    }

    @Override
    public MethodInterceptor getInterceptor(Advisor advisor) {
        ThrowsAdvice advice = (ThrowsAdvice) advisor.getAdvice();
        return new ThrowsAdviceInterceptor(advice);
    }
}
